package ces.org.course.cuixiaowei.api.service; /**
 * <p>Copyright:Copyright(c) 2019</p>
 * <p>Company:Professional</p>
 * <p>Package:ces.org.course.api.service</p>
 * <p>File:DictionaryService.java</p>
 * <p>类更新历史信息</p>
 * @todo chanlong(陈龙) 创建于 May 20, 2019 12:31:08 PM
 */

import ces.org.course.cuixiaowei.api.entity.DictionaryEntity;

import ces.org.course.cuixiaowei.ext.xml.Dictionary;
import ces.org.course.cuixiaowei.ext.xml.DictionaryDocument;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.CachePut;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import java.io.File;

/**
 * <p>描述: </p>
 * <p>Company: Professional</p>
 * @author chanlong(陈龙)
 * @date May 20, 2019 12:31:08 PM
 * @version 1.0.2019
 */
@Service
@CacheConfig(cacheNames = "memcache")
public class DictionaryService {

	@CachePut(key = "#key")
	public DictionaryEntity put(final String key, final File file) {
		Dictionary dictionary = DictionaryDocument.toBean(file);
		return DictionaryEntity.of().create(dictionary);
	}
	
	@Cacheable
	public DictionaryEntity get(final String key) {
		return DictionaryEntity.of();
	}
	
	@CacheEvict
    public void clear(final String key) {
		
	}
}
